package org.ytor.core.sqlflow.dsl.eval.function.support;

import org.ytor.common.util.id.Ids;
import org.ytor.core.sqlflow.dsl.expr.node.support.FunctionCallNode;
import org.ytor.core.sqlflow.dsl.eval.function.Func;
import org.ytor.common.util.Colls;

import java.util.List;
import java.util.UUID;

/**
 * created by yangtong on 2025/8/7 00:19:32
 * <br/>
 */
public class Id implements Func {
    @Override
    public Boolean support(FunctionCallNode functionCallNode) {
        return functionCallNode.functionName.equalsIgnoreCase("id");
    }

    @Override
    public Object call(List<Object> args) {
        if (Colls.isNotEmpty(args)) {
            throw new IllegalArgumentException("id函数不能有参数：id()");
        }

        return Ids.snowflakeId();
    }
}